<?php

/**
 * Groupe form.
 *
 * @package    tfe
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class GroupeForm extends BaseGroupeForm {
    public function configure() {
        unset($this['created_at'], $this['updated_at'], $this['deleted_at'],$this['courrier_electronique_list']);

        $this->widgetSchema['responsable']->setOption('renderer_class', 'sfWidgetFormDoctrineJQueryAutocompleter');
        $this->widgetSchema['responsable']->setOption('renderer_options', array(
                'model' => 'Contact',
                'url'   => '/contact/autocomplete',
        ));

        $this->widgetSchema['membres_list'] = new sfWidgetFormDoctrineChoice(array('multiple' => true, 'model' => 'Contact', 'order_by' => array('nom','asc')));
        $this->widgetSchema['membres_list']->setOption('renderer_class', 'sfWidgetFormSelectDoubleList');
        $this->widgetSchema['membres_list']->setOption('renderer_options', array(
                'label_associated' => 'Sélectionnés',
                'label_unassociated' => 'Non sélectionnés'
        ));

        $this->validatorSchema['mail'] = new sfValidatorEmail();
        $this->validatorSchema['mail']->setMessage('invalid','L\'adresse n\'est pas au bon format');

        $this->embedRelation('Membres','RelationContactForm',array(),'<br /><br /><img src="/sfAdminDashPlugin/images/medium/apply_f2.png" />%content%');
    }
}
